import cv2
import numpy as np

img1 = cv2.imread('3/lena_gray.jpg')

mask1 = np.zeros(img1.shape, dtype=np.uint8)
mask2 = np.ones(img1.shape, dtype=np.uint8) * 255

img2 = cv2.bitwise_xor(img1, mask1)
img3 = cv2.bitwise_xor(img1, mask2)

cv2.imshow('img1', img1)
cv2.imshow('img2', img2)
cv2.imshow('img3', img3)

cv2.waitKey(0)
cv2.destroyAllWindows()